﻿<%@ Application Language="C#" %>

<script runat="server">

    void Application_Start(object sender, EventArgs e) 
    {
        // Code that runs on application startup
        log4net.Config.XmlConfigurator.Configure();

        RegisterRoutes(System.Web.Routing.RouteTable.Routes);
    }
    
    void Application_End(object sender, EventArgs e) 
    {
        //  Code that runs on application shutdown

    }

    // ** URL ROUTING **
    private static void RegisterRoutes(System.Web.Routing.RouteCollection routes)
    {
        routes.Ignore("{resource}.axd/{*pathInfo}");
        routes.Ignore("{resource}.asmx/{*pathInfo}");

        // HOME
        routes.MapPageRoute(
           "CallFunction",           // Route name
           "{FunctionName}", // Route URL
           "~/Default.aspx"      // Web page to handle route
        );

        // PARAMETER
        routes.MapPageRoute(
           "CallFunctionWithParam",           // Route name
           "{FunctionName}/{Param}", // Route URL
           "~/Default.aspx"      // Web page to handle route
        );
       
    }
        
    void Application_Error(object sender, EventArgs e) 
    { 
        // Code that runs when an unhandled error occurs

    }

    void Session_Start(object sender, EventArgs e) 
    {
        // Code that runs when a new session is started
        Session["Flag"] = false;
        //Session["isLogin"] = false;
        Session.Timeout = 60;
    }

    void Session_End(object sender, EventArgs e) 
    {
        // Code that runs when a session ends. 
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc in the Web.config file. If session mode is set to StateServer 
        // or SQLServer, the event is not raised.

    }
       
</script>
